//
//  NEDRequest+Promise.h
//  NEDNetwork
//
//  Created by 000 on 2021/12/26.
//

#import "NEDRequest.h"
#import "NEDRequest+Config.h"
#import <coobjc/COPromise.h>
#import <coobjc/coobjc.h>

NS_ASSUME_NONNULL_BEGIN

@interface NEDRequest<ResponseClass> (Promise)

- (COPromise<ResponseClass> *)promise;

/// co_launch
- (ResponseClass _Nullable)await;

@end

@interface COPromise(CO)

- (id _Nullable)await;

@end


@interface NSError(CO)

+ (instancetype)co_errorWithCode:(NSInteger)code
                        userInfo:(nullable NSDictionary<NSErrorUserInfoKey, id> *)dict
                    errorMessage:(NSString *)errorMessage;

- (NSString *)co_errorMessageInfo;

@end


NS_ASSUME_NONNULL_END
